package com.zaaach.citypicker.db;

import android.content.Context;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

/**
 * Created by Administrator on 2017/2/7.
 */

public class DataBase extends SQLiteOpenHelper {
    public DataBase(Context context){
        this(context,"china.db",null,1);
    }

    public DataBase(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        try {
            String lishi = "create table cityinfo(id  varchar(100),name varchar(100),pinyin varchar(10))";
            sqLiteDatabase.execSQL(lishi);
            Log.i("数据库","建表成功");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
